home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Toolbox
/
Visual Basic Toolbox (P.I.E.)(1996).ISO
/
dll_gen
/
drvplus
/
chgvname.frm
< prev
next >
Wrap
Text File
|
1994-07-22
|
4KB
|
143 lines
VERSION 2.00
Begin Form ChgVname
BackColor = &H00C0C0C0&
BorderStyle = 3 'Fixed Double
Caption = "Change Volume Name"
ClientHeight = 2400
ClientLeft = 1095
ClientTop = 1485
ClientWidth = 3615
ControlBox = 0 'False
Height = 2805
Left = 1035
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2400
ScaleWidth = 3615
Top = 1140
Width = 3735
Begin TextBox Text1
Height = 285
Left = 240
MaxLength = 11
TabIndex = 0
Text = "Text1"
Top = 1200
Width = 3135
End
Begin DriveListBox Drive1
Height = 315
Left = 240
TabIndex = 3
Top = 240
Width = 3135
End
Begin CommandButton CmdOkay
BackColor = &H00C0C0C0&
Cancel = -1 'True
Caption = "O &K A Y"
Height = 375
Left = 1800
TabIndex = 2
Top = 1800
Width = 1575
End
Begin CommandButton CmdChgName
BackColor = &H00C0C0C0&
Caption = "Change &Name"
Default = -1 'True
Height = 375
Left = 240
TabIndex = 1
Top = 1800
Width = 1575
End
End
Dim VolName As String
Sub CmdChgName_Click ()
Screen.MousePointer = 11
NewVolName$ = Text1.Text
If Len(NewVolName$) > 8 Then
x% = Len(NewVolName$)
TempName = Left$(NewVolName$, 8) + "." + Right$(NewVolName$, x% - 8)
NewVolName$ = TempName
End If
If NewVolName$ = "No Label" Then NewVolName$ = ""
NowDrive% = Asc(Left$(UCase$(Drive1.Drive), 1)) - 64
worked% = SetVolName(NowDrive%, NewVolName$)
Screen.MousePointer = 0
If worked% = False And NewVolName$ <> "" Then
MsgBox "Unable to rename volume!", 16, "Drive Error"
Exit Sub
End If
FormPassString = "NewVol"
Unload Me
End Sub
Sub CmdOkay_Click ()
FormPassString = "Okay"
Unload Me
End Sub
Sub Drive1_Change ()
Screen.MousePointer = 11
DriveLabel$ = UCase$(Drive1.Drive)
DriveNbr% = Asc(DriveLabel$) - 64
x& = GetDriveSize(DriveNbr%)
Screen.MousePointer = 0
If x& = 0 Then
MsgBox "Unavailable drive!", 16, "Drive Error " + DriveLabel$
drv% = GetDefaultDrive()
Drive1.Drive = UCase$(Chr$(drv% + 64))
End If
GetVolName
Text1.Text = VolName$
Text1.SetFocus
End Sub
Sub Form_Load ()
FormCenterForm Me, DemoMain
GetVolName
Text1.Text = VolName$
Screen.MousePointer = 0
End Sub
Sub Form_Paint ()
DoForm3D Me, sunken, 3, 0
DoForm3D Me, raised, 1, 3
End Sub
Sub GetVolName ()
DriveLabel$ = Left$(UCase$(Drive1.Drive), 2)
FileSpec$ = DriveLabel$ + "\*.*"
FoundIt$ = Dir$(FileSpec$, 8)
If FoundIt$ = "" Then FoundIt$ = "No Label"
If Len(FoundIt$) > 8 Then
FoundIt$ = Strip(FoundIt$, ".")
End If
VolName$ = FoundIt$
End Sub
Sub Text1_GotFocus ()
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End Sub
Sub Text1_KeyPress (KeyAscii As Integer)
Char = Chr(KeyAscii)
KeyAscii = Asc(UCase(Char))
If Char = Chr$(8) Then Exit Sub
If KeyAscii >= Asc("0") And KeyAscii <= Asc("9") Then Exit Sub
If KeyAscii = Asc(" ") Then Exit Sub
If KeyAscii = Asc("*") Then Exit Sub
If KeyAscii = Asc("$") Then Exit Sub
If KeyAscii = Asc("!") Then Exit Sub
If KeyAscii < Asc("A") Or KeyAscii > Asc("Z") Then
KeyAscii = 0
Exit Sub
End If
End Sub